<template>
	<view class="success-body">
		<image src="../../static/image/order/success.png" v-if="pay_state == 1" mode="widthFix" class="success-logo"></image>
		<image src="../../static/image/order/pay-error.png" v-else mode="widthFix" class="success-logo"></image>
		<view class="pay-msg">{{pay_state == 1 ? '订单支付成功！' : '订单支付失败！'}}</view>
		<view class="pay-memo">
			{{pay_state == 1 ? '我们会尽快安排发货，请耐心等候' : '订单交易已被中止'}}
		</view>
		<view class="success-btn" @tap="jump(1)">
			<uni-btn>查看订单</uni-btn>
		</view>
		<view class="success-btn" @tap="jump(2)">
			<uni-btn bg="#999">返回首页</uni-btn>
		</view>
	</view>
</template>

<script>
	import uniBtn from '../../components/unit/button.vue';
	
	export default{
		components:{uniBtn},
		data(){
			return {
				pay_state : 0
			}
		},
		onLoad(e) {
			this.pay_state = e.pay_state;
		},
		methods:{
			jump(state){
				if(state == 1) {
					uni.redirectTo({
						url:'/pages/order/list'
					})
				}else{
					uni.switchTab({
						url:'/pages/index/homePage'
					})
				}
			}
		}
	}
</script>

<style>
	.success-logo{display: block;width: 25%;margin: auto;margin-top: 150upx;}
	.success-body::before{content: '';display: table;}
	.pay-msg{text-align: center;padding:20upx 0;font-size: 36upx;font-weight: bold;margin-top: 20upx;}
	.pay-memo{color:#999999;text-align: center;margin-bottom: 100upx;}
	.success-btn{width: 80%;margin:auto;margin-top: 40upx;}
</style>
